import proFetch from 'src/hrpub/common/utils/project-fetch';
import {COMMON} from "../unit/util";

export default {
    name: 'staffCom',
    data: {
        language: {}, // 多语
        page: COMMON.pageMain, // 显示的页面
        formSub: false, //是否穿透详情页返回的
        hrorgobj: {}, // 组织对象
        pk_org: null, // 组织
        pk_psncl: null, // 人员类别
        psncobj: {}, // 人员类别
        advObj: {}, // subdetail 数据
        mainDate: '', // 主页面日期
    },
    sync: {
        update(state, payload) {
            return {
                ...state,
                ...payload
            };
        }
    },
    async: {
        // 人数统计
        getStaffStatic(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/companalysis/StaffStaticAction.do',
                body: payload.postData
            });
        },
        // 获取年龄与学历结构数据
        queryAgeEduEchart(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/companalysis/AgeEduStructureAction.do',
                body: payload.postData
            });
        },
        // 获取入离职趋势数据
        queryEntryDimi(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/companalysis/EntryDimissionTrendAction.do',
                body: payload.postData
            });
        },
        // 获取职级数据
        queryJobGradeEchart(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/companalysis/JobGradeStructureAction.do',
                body: payload.postData
            });
        },
        // 获取人员变动数据
        queryStaffChange(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/companalysis/StaffChangeAnalysisAction.do',
                body: payload.postData
            });
        },
        // 人员信息简表(总人数)
        getStaffInfo(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/companalysis/StaffInfoAction.do',
                body: payload.postData
            });
        },
        // 入职详情（本月已入职）
        getEntryInfo(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/companalysis/EntryDetailsAction.do',
                body: payload.postData
            });
        },
        // 离职详情（本月已离职）
        getDimiInfo(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/companalysis/DimissionDetailsAction.do',
                body: payload.postData
            });
        },
        // 变动详情（本月变动）
        getChangeInfo(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/companalysis/ChangeDetailsAction.do',
                body: payload.postData
            });
        },
        // 待转正详情（待转正）
        getRegInfo(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/companalysis/StayPositiveDetailsAction.do',
                body: payload.postData
            });
        },
        // 人才结构统计（年龄与学历结构/职级结构）
        getStaffStruInfo(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/companalysis/TalentStructureAction.do',
                body: payload.postData
            });
        },
        // 人员流动统计（入离职趋势/人员变动分析）
        getStaffFlowInfo(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/companalysis/TalentFlowAction.do',
                body: payload.postData
            });
        }
    }
}
